//
//  AdImgeView.m
//  DianXunTong
//
//  Created by Ethan on 14-6-9.
//  Copyright (c) 2014年 mac iko. All rights reserved.
//

#import "AdImgeView.h"
#import "SDWebImageManager.h"

@implementation AdImgeView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}


-(void)setImgUrl:(NSString *)imgUrl{
    _imgUrl = imgUrl;
    
    [[SDWebImageManager sharedManager]downloadImageWithURL:[NSURL URLWithString:[imgUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] options:SDWebImageLowPriority progress: nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
        if (image &&finished) {
            self.image = image;
            [self setNeedsLayout];
        }
    }];
}


@end
